<%@ page contentType="text/html; charset=UTF-8"%>
<%@ page trimDirectiveWhitespaces="true"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="/tags/zc" prefix="zc"%>
<%@ taglib tagdir="/WEB-INF/tags" prefix="zcx"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>${comments!}</title>
        <zc:link href="style.css" />
        <zc:script src="jquery.js" />
        <zc:script src="Public.js" />
        <zc:iniCalendar />
        <zc:script src="DateControl.js" />
        <script type="text/javascript">
            $(document).ready(function(){
                //查询
                $("#btSearch").click(function(){
                    doRefresh();
                });
                // 新增
                $("#btAdd").click(function(){
                    var varAction = "${r"${"}ctx}/${packageName!}/${className!}/add${className?cap_first!}.do" ;
                    var dialog = openDialog({title : '新增${comments!}',width : '95%',height :'95%',end : function() {doRefresh();}});
                    $("#dataForm").attr("action",varAction).attr("target",dialog).submit() ;
                });
            });

            function doRefresh(){
                refreshPage(-1);
            }
            function edit${className?cap_first!}(${className!}id) {
                $("#${className!}id").val(${className!}id);
                var varAction = "${r"${"}ctx}/${packageName!}/${className!}/edit${className?cap_first!}.do";
                var dialog = openDialog({title : '编辑${comments!}',width : '95%',height : '95%',end : function() {doRefresh();}});
                $("#dataForm").attr("action", varAction).attr("target", dialog).submit();
            }

            function view${className?cap_first!}(${className!}id) {
                $("#${className!}id").val(${className!}id);
                var varAction = "${r"${"}ctx}/${packageName!}/${className!}/view${className?cap_first!}.do";
                var dialog = openDialog({title : '查看${comments!}',width : '95%',height : '95%',end : function() {}});
                $("#dataForm").attr("action", varAction).attr("target", dialog).submit();
            }
            function del${className?cap_first!}(${className!}id){
                if (!confirm("确定要删除吗？删除后不能恢复!")) return;
                var varAction = "${r"${"}ctx}/${packageName!}/${className!}/del${className?cap_first!}.do";
                $.ajax({
                    cache: true,
                    type: "post",
                    url:varAction,
                    data:{'${className!}id':${className!}id},
                    async: true,
                    dataType: "json",
                    timeout:5000,
                    error: function(request) {
                        alert("网络异常");
                    },
                    success: function(data) {
                        if(data.status == -1){
                            alert(data.msg);
                        }else{
                            doRefresh();
                        }
                    }
                });
            }
            function clXmzt(zdbs,zt) {
                $("#"+zdbs).val(zt);
                $("a[dm='"+zdbs+"']").removeClass("on");
                $("a[dm='"+zdbs+"'][dt='"+zt+"']").addClass("on");
                doRefresh();
            }
        </script>
    </head>
    <body>
        <form id="dataForm" name="dataForm" method="post">
            <input type="hidden" id="${className!}id" name="${className!}id"/>
            <input type="hidden" id="shzt" name="shzt"/>

            <div class="wap search d2">
                <div class="container">
                    <div class="item">
                        <span class="gb color secondary">审核状态：</span>
                        <span class="wap selection">
                            <a href="###" class="on" dm="shzt" dt="" onclick="clXmzt('shzt','');">全部</a>
                            <a href="###" dm="shzt" dt="0" onclick="clXmzt('shzt','0');">${r"${"}zc:mcByKey('SHZT', '0')}</a>
                            <a href="###" dm="shzt" dt="2" onclick="clXmzt('shzt','2');">${r"${"}zc:mcByKey('SHZT', '2')}</a>
                            <a href="###" dm="shzt" dt="1" onclick="clXmzt('shzt','1');">${r"${"}zc:mcByKey('SHZT', '1')}</a>
                        </span>
                        <div style="float:right">
                            <input type="button" id="btAdd" name="btAdd" class="btn btn4 btn-add" value="新增" />
                        </div>
                    </div>
                    <div class="splitline"></div>
                    <div class="item">
                        <span class="gb color secondary">采购方式：</span>
                        <zc:Select name="cgfs" id="cgfs" dmlb="CGFS" textField="dmmc" blankText="采购方式" valueField="dmbs" value="${r"${"}cgfs}" onChange="doRefresh()"/>
                        &nbsp;&nbsp;
                        <span class="gb color secondary">查询内容：</span>
                        <input class="form-control" type="text" style="width:250px;" id="content" name="content" value="${r"${"}content}" placeholder="项目编号/项目名称...">
                        <input type="button" id="btSearch" name="btSearch" class="btn btn4 btn-search"  value="查询" />
                    </div>
                </div>
            </div>

            <div id="dataC">
                <%@ include file="IcList${className?cap_first!}.jsp" %>
            </div>
        </form>
    </body>
</html>